//
//  ChooseNameView.swift
//  loveHHEveryDay
//
//  Created by yw on 2025/4/8.
//

import SwiftUI

struct ChooseNameView: View {
    @Binding var userName:String
    var body: some View {
        VStack {
            HStack {
                TextField("请输入姓名", text: $userName)
                Image(systemName: "dice.fill")
                    .resizable()
                    .aspectRatio(contentMode: .fill)
                    .frame(width: 24, height: 24)
                    .accentColor(Color("color_text_main"))
                    .shakeTapGes {
                        getRandomName()
                    }
            }
            .padding(.horizontal,10)
            
            .frame(height: 50)
            .background(.white)
            .cornerRadius(14)
            .padding(.horizontal,10)
            .padding(.top,20)
            Spacer()
            
        }.frame(maxWidth: .infinity)
            .frame(height:220)
            .padding(.vertical,80)
    }
    
    private func getRandomName() {
        
        userName = RandomNameTool.getName()
        
        
    }
}

